<form {if $id>0}action="{php echo webUrl('exchange/redpacket/edit',array('id'=>$id),true);}"{else}action="{php echo webUrl('exchange/redpacket/add',array(),true);}"{/if} method="post" class="form-validate">
    <div class="modal-dialog" style="width: 450px">
        <div class="modal-content">
            <div class="modal-body">
                <div class="row">
                    <div class="col-sm-12">
                        <h3>{if $id>0}编辑红包兑换任务{else}添加红包兑换任务{/if}</h3><br>
                        <label>兑换任务标题：</label>
                        <input type="text" placeholder="请输入标题" class="form-control" name="title" value="{$setting['title']}">
                        <br>
                        <label>开始时间：</label>
                        {php echo tpl_form_field_date('starttime',$setting['starttime'],true);}
                        <br>
                        <label>截止时间：</label>
                        {php echo tpl_form_field_date('endtime',$setting['endtime'],true);}
                        <br>

                        <label>兑换模式:</label>&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="radio" name="type" class="type" value="1" id="bdadd" onclick="$('#zhiding').show();$('#suiji').hide();"
                               {if $setting['type']!=2}checked{/if}><label for="bdadd"> 指定余额兑换</label>&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="radio" name="type" class="type" value="2" id="adadd" onclick="$('#zhiding').hide();$('#suiji').show();"
                               {if $setting['type']==2}checked{/if}><label for="adadd"> 随机余额兑换</label>
                        <br><br>
                        
                        <div id="alertadd">
                            <div class="zhiding" id="zhiding" {if $setting['type']==2}style="display: none"{/if}>
                                <label>请输入红包面值(单位:元)：</label>
                            <input type="text" class="form-control" name="value" value="{$setting['red']}">
                            </div>
                            <div class="suiji" id="suiji" {if $setting['type']!=2}style="display: none"{/if}>
                                <label>请输入随机红包范围(单位:元)：</label><br>
                        <div class="input-group m-b">
                                           <input type="text" class="form-control" name="left_rand" value="{$setting['red_left']}">
                            <span class="input-group-btn"><span class="btn btn-default">至</span></span>
                            <input type="text" class="form-control" name="right_rand" value="{$setting['red_right']}">
                        </div>
                    </div>
                    <br>
                            <div style="margin-top: 10px;text-align: center">
                                <button type="submit" class="btn btn-primary" >
                                {if $id>0}保存{else}添加{/if}
                            </button>
                            <button type="button" class="btn btn-primary btn-outline"  data-dismiss="modal">
                                取消
                            </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
